<?php 
	include("includes/connect.php");
	include("includes/function.php");

	$petition_id = $_REQUEST["petition_id"];

	$task = $_REQUEST["task"];

	$cheque_no = $_REQUEST["cheque_no"];

?>

<script type="text/javascript">
	$(document).ready(function(){
		$("#i_date").datepicker({
			dateFormat: "yy-mm-dd",
			showButtonPanel: true
		 });

		$("#save_menus").click(function() {
			event.preventDefault();

			var i_date = $("#i_date").val();
			var task = "<?php echo $task; ?>";
			var petition_id = "<?php echo $petition_id; ?>";
			var cheque_no = "<?php echo $cheque_no; ?>";
			//alert(cheque_no);
			
			
			
			$.post('processPetition.php',{task: task, petition_id: petition_id, i_date: i_date, cheque_no:cheque_no}, function(data) {
				if (task == "approvedCheque") {
					window.location.href="index.php?pages=paid";
				} else if (task == "approved") {
					window.location.href="index.php?pages=finance";
				}
				
			});
			
			
			
			

		});
	});
</script>

<p>
    <label>วันที่</label>
	<input class="span3" type="text" id="i_date" name="i_date" />


</p>
<div class="form-actions">
	<button class="btn btn-primary" id="save_menus">Save changes</button>
	<button class="btn close-dialog"><i class="icon-remove"></i> ยกเลิก</button>

</div>
